Fix split of duties between close_netdev() and
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 4 Jan 2006 13:45:52 +0000 (14:45 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 4 Jan 2006 13:45:52 +0000 (14:45 +0100)
netif_disconnect_backend() in netif driver.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c

index eca6b4c888786d346e34578909937d43cbfcd1d0..2acba6b21d58d671dd14aa7c587897b91e2d31c0 100644 (file)
@@ -1218,22 +1218,14 @@ static int netfront_remove(struct xenbus_device *dev)
 
 static void close_netdev(struct netfront_info *info)
 {
-       /* Stop old i/f to prevent errors whilst we rebuild the state. */
-       spin_lock_irq(&info->tx_lock);
-       spin_lock(&info->rx_lock);
+       spin_lock_irq(&info->netdev->xmit_lock);
        netif_stop_queue(info->netdev);
-       /* info->backend_state = BEST_DISCONNECTED; */
-       spin_unlock(&info->rx_lock);
-       spin_unlock_irq(&info->tx_lock);
+       spin_unlock_irq(&info->netdev->xmit_lock);
 
 #ifdef CONFIG_PROC_FS
        xennet_proc_delif(info->netdev);
 #endif
 
-       if (info->irq)
-               unbind_from_irqhandler(info->irq, info->netdev);
-       info->evtchn = info->irq = 0;
-
        del_timer_sync(&info->rx_refill_timer);
 
        unregister_netdev(info->netdev);
@@ -1242,6 +1234,17 @@ static void close_netdev(struct netfront_info *info)
 
 static void netif_disconnect_backend(struct netfront_info *info)
 {
+       /* Stop old i/f to prevent errors whilst we rebuild the state. */
+       spin_lock_irq(&info->tx_lock);
+       spin_lock(&info->rx_lock);
+       info->backend_state = BEST_DISCONNECTED;
+       spin_unlock(&info->rx_lock);
+       spin_unlock_irq(&info->tx_lock);
+
+       if (info->irq)
+               unbind_from_irqhandler(info->irq, info->netdev);
+       info->evtchn = info->irq = 0;
+
        end_access(info->tx_ring_ref, info->tx.sring);
        end_access(info->rx_ring_ref, info->rx.sring);
        info->tx_ring_ref = GRANT_INVALID_REF;